#define _GNU_SOURCE
#include <plane.h>
#include <stdio.h>
#include <stdlib.h>

plane_t *
plane_new( void )
{
  return calloc( 1, sizeof( plane_t ) );
}

void
plane_free( plane_t *plane )
{
  assert( plane != NULL );
  free( plane );
}

char *
plane_str( const plane_t plane )
{
  char *s = NULL;

  char *a = vector3_str( plane.point );
  char *b = vector3_str( vector3_normalize( plane.normal ) );

  asprintf( &s, "<plane point=%s normal=%s>", a, b );

  free( a );
  free( b );

  return s;
}
